<!-- 保险公司管理 -->
<template>
	<div>
		<div class="container">
			<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
			    <el-tab-pane label="公司简介" name="first">
					<editor-bar v-model="gsjjContext" :isClear="isClear"></editor-bar>
					<div style="width: 100%;text-align: center;margin-top: 15px;">
						<el-button type="primary" @click="handleAdd(1)">保存</el-button>
					</div>
				</el-tab-pane>
			    <el-tab-pane label="保险协议" name="second">
					<editor-bar v-model="bxxyContext" :isClear="isClear"></editor-bar>
					<div style="width: 100%;text-align: center;margin-top: 15px;">
						<el-button type="primary" @click="handleAdd(2)">保存</el-button>
					</div>
				</el-tab-pane>
			    <el-tab-pane label="合同协议" name="third">
					<editor-bar v-model="htxyContext" :isClear="isClear"></editor-bar>
					<div style="width: 100%;text-align: center;margin-top: 15px;">
						<el-button type="primary" @click="handleAdd(3)">保存</el-button>
					</div>
				</el-tab-pane>
			</el-tabs>
		</div>
	</div>
</template>

<script>
import { } from '@/api/index';
import EditorBar from '../../components/wangEnduit.vue';
export default {
	components:{EditorBar},
	name: 'role',
	data() {
		return {
			loading: false,
			activeName: 'first',
			isClear: false,
			ContextId:'',
			gsjjContext:'',
			bxxyContext:'',
			htxyContext:'',
		};
	},
	mounted() {
		// this.getData();
	},
	methods: {
		// 获取表格数据
		getData() {
			this.loading = true;
			var parems = {
				pageNum:1,
				pageSize:100
			}
			findBxgsxxList(parems).then(res => {
				if (res.code == 200) {
					this.gsjjContext = res.data.list[0].gsjj;
					this.bxxyContext = res.data.list[0].bxxy;
					this.htxyContext = res.data.list[0].htxy;
					this.ContextId = res.data.list[0].id;
					this.loading = false;
				} else {
					this.loading = false;
				}
			});
		},
		// 查询
		handleClick(e) {
			this.activeName = e.paneName
		},
		handleAdd(){
			if(this.activeName == 'first'){
				var parems = {
					id:this.ContextId,
					gsjj:this.gsjjContext
				}
			}else if(this.activeName == 'second'){
				var parems = {
					id:this.ContextId,
					bxxy:this.bxxyContext
				}
			}else if(this.activeName == 'third'){
				var parems = {
					id:this.ContextId,
					htxy:this.htxyContext
				}
			}
			addOrUpdateBxgsxx(parems).then(res => {
				if (res.code == 200) {
					this.$message.success('保存成功');
					this.getData();
				} else {
					this.$message.error(res.message);
				}
			});
		},
	}
};
</script>

<style scoped>
/deep/.el-transfer-panel__item.el-checkbox {
	width: 100px;
}
/deep/.el-transfer-panel {
	width: 240px;
}
.meun{
	display: flex;align-items: center;justify-content: center;
}
.meun_list{
	width: 100%; padding: 0 15px;
}
.red {
	color: #67C23A !important;
}
.red1{
	color: #F56C6C !important;
}
.check1{
	font-weight: 600;
	margin-bottom: 15px;
}
.line-check{
	display: inline-block; 
	margin-left: 25px;
	margin-bottom: 20px;
}
.mb8 {
	margin-bottom: 10px;
}
.handle-box {
	margin-bottom: 20px;
}

.handle-select {
	width: 120px;
}

.handle-input {
	width: 300px;
	display: inline-block;
}
.table {
	width: 100%;
	font-size: 13px;
}
.red {
	color: #ff0000;
}
.mr10 {
	margin-right: 10px;
}
.table-td-thumb {
	display: block;
	margin: auto;
	width: 40px;
	height: 40px;
}
</style>
